package com.koron.order.risk.keyPoint.bean.vo;

import com.koron.order.risk.base.bean.po.LineRiskPart;
import com.koron.order.risk.keyPoint.bean.po.LineRiskKeyPoint;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * @author jzp
 * @since 2023/1/5
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class LineRiskKeyPointVO extends LineRiskKeyPoint {

    @ApiModelProperty(value = "塔段信息")
    private List<LineRiskPart> lineRiskPartList;

    public String getLineRiskPartStr() {
        if (lineRiskPartList == null) {
            return null;
        }
        if (lineRiskPartList.size() == 1) {
            return lineRiskPartList.get(0).getEquipmentName();
        } else {
            String first = lineRiskPartList.get(0).getEquipmentName();
            String last = lineRiskPartList.get(lineRiskPartList.size() - 1).getEquipmentName();
            return first + "~" + last;
        }
    }

}
